package org.carabiner.example;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JToolBar;

/**
 * An example application that allows the user to create an manipulate geometric shapes. 
 * 
 * @author Ben Rady
 */
public class JavaShaper extends JFrame
{
  private ShapeView shapeView;

  public JavaShaper()
  {
    setTitle("Carabiner Example - Java Shaper");
    getContentPane().setLayout(new BorderLayout());
    shapeView = new ShapeView();
    getContentPane().add(shapeView, BorderLayout.CENTER);
    getContentPane().add(createToolbar(shapeView), BorderLayout.NORTH);    
    pack();
  }  
  
  private Component createToolbar(View view)
  {
    JToolBar toolbar = new JToolBar();
    toolbar.add(new AddSquareAction(view));
    return toolbar;
  }

  public static void main(String[] args)
  {
    JavaShaper shaper = new JavaShaper();
    shaper.setVisible(true);
  }


  public ShapeModel getModel()
  {
    return shapeView.getShapeModel();
  }

}
